<template>
  <div class="cart-list-item">
    <div class="selector">
      <check-button :is-checked="product.checked" @click.native="checkClick" />
    </div>
    <div class="album">
      <img :src="product.image" alt="">
    </div>
    <div class="info">
      <div class="title nowrap_ellipsis">{{product.title}}</div>
      <div class="desc nowrap_ellipsis">商品描述: {{product.desc}}</div>
      <div class="bottom">
        <span class="price">¥{{product.price}}</span>
        <span class="count">x{{product.count}}</span>
      </div>
    </div>
  </div>
</template>

<script>
import CheckButton from 'components/content/checkbutton/CheckButton'

export default {
  components: {
    CheckButton
  },
  props: {
    product: {
      type: Object,
      default() {
        return {}
      }
    }
  },
  methods: {
    checkClick() {
      this.product.checked = !this.product.checked;
    }
  }
}
</script>

<style scoped>
.cart-list-item {
  display: flex;
  align-items: center;
  padding: 5px;
  border-bottom: 1px solid #ccc;
}

.selector {
  padding: 0 10px 0 5px;
}

.album img {
  width: 80px;
  height: 100px;
  border-radius: 5px;
  object-fit: cover;
}

.info {
  padding: 5px 10px;
  font-size: 17px;
  color: #333;
  overflow: hidden;
}

.info .desc {
  margin-top: 15px;
  font-size: 14px;
  color: #666;
}

.bottom {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
}

.bottom .price {
  color: #ff4500;
}
</style>